package com.ten.shou.controller;


import com.ten.common.core.entity.TbLink;
import com.ten.common.core.vo.Result;
import com.ten.shou.service.LinkService;
import com.ten.shou.vo.LinkVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ：杨（1964958771@qq.com）
 * @date ：Created in 2022/12/9 21:18
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/home/link")
public class LinkController {
    @Resource
    private LinkService linkService;
    @PostMapping("getAllLink/{current}/{pageSize}")
    public Result getAllLink(@PathVariable Integer current, @PathVariable Integer pageSize, @RequestBody LinkVo linkVo){
        return linkService.queryAllLink(current,pageSize,linkVo);
    }
    @PostMapping("addLink")
    public Result addLink(@RequestBody TbLink tbLink){
        return linkService.insertAllLink(tbLink);
    }
    @PostMapping("changeStatus/{linkId}/{isDisable}")
    public Result changeStatus(@PathVariable String linkId,@PathVariable String isDisable){
        return linkService.updateLinkStatus(linkId,isDisable);
    }
    @PostMapping("deleteLink")
    public Result deleteLink(@RequestBody LinkVo linkVo){
        return linkService.deleteLinkByLinkId(linkVo);
    }
    @PostMapping("updateLink")
    public Result updateLink(@RequestBody TbLink tbLink){
        return linkService.updateLinkName(tbLink);
    }
}
